class Role:
    '类声明'
    def __init__(self, name, weapon):
        '该方法被称作构造器方法，用于将属性绑定在实例身上'
        # self不是关键字，可以是任意的合法名称
        self.name = name
        self.weapon = weapon
class Weapon:
    def __init__(self,wname, strength):
        self.wname =wname
        self.strength = strength


if __name__ == '__main__':
    # 根据类创建出具体的实例，自动调用__init__方法，实例将自动作为第一个参数
    ji = Weapon('方天画戟', 100)
    # print(ji.wname)
    # print(ji.strength)
    mao = Weapon('丈八点蛇矛', 90)
    # print(mao.wname)
    # print(mao.strength)
    lb = Role('吕布', ji)
    print(lb.weapon.wname)
    print(lb.weapon.strength)
    lb =Role('张飞', mao)
    print(lb.weapon.wname)
    print(lb.weapon.strength)